export {}

interface Post {
  title: string
  content: string
  subtitle?: string // 可选成员
  readonly summary: string // 只读成员
}

const hello: Post = {
  title: 'Hello TypeScript',
  content: 'A JavaScript superset',
  summary: 'A javascript',
};

// hello.summary = 'other'; //报错

// ---------------------------

interface Cache { // 成员的值必须是对象
  [prop: string]: string
}

const cache: Cache = {};
cache.foo = 'foo';
cache.bar = 'bar';
cache.num = '100';
// cache.num2 = 100; // 报错
